package com.fastfood.controller;

import java.util.ArrayList;
import java.util.List;

import com.fastfood.model.blo.FoodTypeBLO;
import com.fastfood.model.dto.FoodType;
import com.opensymphony.xwork2.ActionSupport;

public class FoodTypeAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	
	private FoodTypeBLO foodTypeBLO;
	
	private List<FoodType> listFoodType;
	private FoodType foodType;

	public FoodTypeAction() {
		foodTypeBLO = new FoodTypeBLO();
		listFoodType = new ArrayList<FoodType>();
	}
	
	public String list() {
		List<FoodType> temp = foodTypeBLO.getAllFoodTypes();
		if (temp != null) listFoodType = temp;
		return SUCCESS;
	}
	
	public String add() {
		foodTypeBLO.addFoodType(foodType);
		return SUCCESS;
	}
	
	public String update() {
		foodTypeBLO.updateFoodType(foodType);
		return SUCCESS;
	}
	
	public String delete() {
		foodTypeBLO.deleteFoodType(foodType);
		return SUCCESS;
	}

	public List<FoodType> getListFoodType() {
		return listFoodType;
	}

	public void setListFoodType(List<FoodType> listFoodType) {
		this.listFoodType = listFoodType;
	}

	public FoodType getFoodType() {
		return foodType;
	}

	public void setFoodType(FoodType foodType) {
		this.foodType = foodType;
	}
}